1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.google.common.cache;
18
19 import com.google.common.annotations.Beta;
20 import com.google.common.base.Preconditions;
21 import com.google.common.collect.ImmutableMap;
22
23 import java.util.concurrent.ExecutionException;
24
25
26
27
28
29
30
31
32
33
34
35
36 @Beta
37 public abstract class ForwardingLoadingCache<K, V>
38 extends ForwardingCache<K, V> implements LoadingCache<K, V> {
39
40
41 protected ForwardingLoadingCache() {}
42
43 @Override
44 protected abstract LoadingCache<K, V> delegate();
45
46 @Override
47 public V get(K key) throws ExecutionException {
48 return delegate().get(key);
49 }
50
51 @Override
52 public V getUnchecked(K key) {
53 return delegate().getUnchecked(key);
54 }
55
56 @Override
57 public ImmutableMap<K, V> getAll(Iterable<? extends K> keys) throws ExecutionException {
58 return delegate().getAll(keys);
59 }
60
61 @Override
62 public V apply(K key) {
63 return delegate().apply(key);
64 }
65
66 @Override
67 public void refresh(K key) {
68 delegate().refresh(key);
69 }
70
71
72
73
74
75
76
77 @Beta
78 public abstract static class SimpleForwardingLoadingCache<K, V>
79 extends ForwardingLoadingCache<K, V> {
80 private final LoadingCache<K, V> delegate;
81
82 protected SimpleForwardingLoadingCache(LoadingCache<K, V> delegate) {
83 this.delegate = Preconditions.checkNotNull(delegate);
84 }
85
86 @Override
87 protected final LoadingCache<K, V> delegate() {
88 return delegate;
89 }
90 }
91 }